package com.dikang.yygh.controller;

import com.dikang.yygh.common.result.Result;
import com.dikang.yygh.service.HospitalService;
import com.dikang.yygh.vo.hosp.HospitalQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/admin/hosp/hospital")
@RestController
@Api(tags = "医院管理接口")
public class HospitalController {
    @Autowired
    private HospitalService hospitalService;


    @GetMapping("list/{page}/{limit}")
    public Result getHospitalList(
            @ApiParam(name = "page", value = "当前页码", required = true)
            @PathVariable Integer page,

            @ApiParam(name = "limit", value = "每页记录数", required = true)
            @PathVariable Integer limit,

            @ApiParam(name = "hospitalQueryVo", value = "查询对象", required = false)
                    HospitalQueryVo hospitalQueryVo){
        hospitalService.selectPage(page, limit, hospitalQueryVo);
        return Result.ok(hospitalService.selectPage(page, limit, hospitalQueryVo));
    }
    // 更新医院闪现状态
    @GetMapping("updateStatus/{id}/{status}")
    public Result lock(
             @PathVariable("id") String id,
             @PathVariable("status") Integer status){
        hospitalService.updateStatus(id,status);
        return Result.ok();
    }
    @ApiOperation(value = "获取医院详情")
    @GetMapping("showHospDetail/{id}")
    public Result showDetial(@PathVariable String id){
        return Result.ok( hospitalService.show(id));

    }


}
